/*
 * @Author: fishroom
 * @Date: 2021-09-14 02:02:53
 * @LastEditTime: 2021-09-29 19:52:19
 * @FilePath: \website\src\router\index.js
 */
import { createRouter, createWebHistory } from "vue-router";
import MainView from "../views/main/MainView.vue";

const routes = [
  {
    path: "/",
    name: "MainView",
    component: MainView,
    meta: {
      title: "快乐的鱼",
    },
    children: [
      {
        path: "/",
        name: "Home",
        component: () => import(/* webpackChunkName: "about" */ "../views/home/Home.vue"),
      },
      {
        path: "/about",
        name: "About",
        component: () => import(/* webpackChunkName: "about" */ "../views/about/About.vue"),
      },
      {
        path: "/share",
        name: "Share",
        component: () => import(/* webpackChunkName: "about" */ "../views/share/Share.vue"),
      },
    ],
  },
];
const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes,
});
router.beforeEach((to, from, next) => {
  document.title = to.matched[0].meta.title;
  next();
});

export default router;
